[Store] Clarify cache stats semantics - #2248
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the cache hit metrics in Mooncake Store to clarify that they represent Store-observed cache reuse signals rather than end-to-end request-level or token-level hit ratios. It introduces enum aliases (such as MEMORY_CURRENT_CACHED_OBJECTS and MEMORY_HITS_PER_CURRENT_CACHED_OBJECT) to replace legacy hit rate names, updates documentation, and adds corresponding unit tests. Feedback highlights two main issues: first, moving VALID_GET_RATE in the CacheHitStat enum alters the underlying integer values, which breaks RPC backward compatibility; second, the new unit test CalcCacheStatsTest is not hermetic because it relies on the residual state of the MasterMetricManager singleton from previous tests.
Signed-off-by: CAICAIIs <3360776475@qq.com>
931a0e8 to
6213188
Compare
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
LGTM. Thanks a lot for your clarification! |
Signed-off-by: CAICAIIs <3360776475@qq.com>
Description
Refs #972.
This PR clarifies the semantics of Mooncake Store cache stats.
The existing
*_HIT_RATEvalues incalculate_cache_stats()are Store-observed reuse signals. They divide cumulative Store-side hits by the current cached object count, so they may exceed1.0. They are not end-to-end request-level or token-level cache hit ratios.This change:
*_HITS_PER_CURRENT_CACHED_OBJECTand*_CURRENT_CACHED_OBJECTS.*_HIT_RATE,*_TOTAL, andVALID_GET_RATEenum values for RPC/API compatibility.CalcCacheStatsTestexecution, and values greater than1.0.transport-selectorTENT toctree entry so the strict Sphinx docs build can include the existing page.Module
mooncake-transfer-engine)mooncake-store)mooncake-ep)mooncake-integration)mooncake-p2p-store)mooncake-wheel)mooncake-pg)mooncake-rl)Type of Change
How Has This Been Tested?
On a remote Linux validation host:
git diff --check HEAD~1./scripts/code_format.sh --check --base HEAD~1cd docs && make html SPHINXOPTS=-W SPHINXBUILD=/root/miniconda3/bin/sphinx-buildcmake --build build --target master_metrics_test -j"$(nproc)"./build/mooncake-store/tests/master_metrics_test --gtest_filter=MasterMetricsTest.CalcCacheStatsTestMC_METADATA_SERVER=http://127.0.0.1:8080/metadata DEFAULT_KV_LEASE_TTL=500 ctest --test-dir build -R master_metrics_test --output-on-failureChecklist
./scripts/code_format.shbefore submitting.